package com.smartcampusbackend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.smartcampusbackend.model.InterestCommunityMember;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;

@Mapper
public interface InterestCommunityMemberMapper extends BaseMapper<InterestCommunityMember> {
    
    // 检查用户是否已加入社群
    InterestCommunityMember findByUserAndCommunity(@Param("userId") Integer userId, @Param("communityId") Integer communityId);
    
    // 获取社群的所有成员
    List<InterestCommunityMember> findByCommunityId(@Param("communityId") Integer communityId);
    
    // 获取社群的成员数量
    int countByCommunityId(@Param("communityId") Integer communityId);
    
    // 删除社群的所有成员
    int deleteByCommunityId(@Param("communityId") Integer communityId);
    
    // 删除指定社群的指定成员
    int deleteByCommunityIdAndUserId(@Param("communityId") Integer communityId, @Param("userId") Integer userId);
} 